<template>
    <div class="moviesPlay">
        <div class="play-box">
            <iframe
                :src="'https://okjx.cc/?url=' + url"
            ></iframe>
        </div>
    </div>
</template>

<script>
    import { emitMobiesLink } from '@/api/moviesLink'
    import { mapMutations, mapState } from 'vuex'
    export default {
        data() {
            return {
                url : ''
            }
        },
        //计算属性
        computed:{
            ...mapState(['moviesDetail'])
        },
        created() {
            this.paraeUrl()
        },
        methods: {
            paraeUrl(){
                if (this.moviesDetail.movies.type == '电影') {
                    this.url = this.moviesDetail.movies.url
                // }else if(this.moviesDetail.movies.type == '电视剧'){
                //     this.url = this.moviesDetail.movies.url
                //     .replace('.html', '/' + this.moviesDetail
                //     .moviesEpisodes[this.moviesDetail.moviesLink.numEpisodes].url
                //     + '.html')
                //     console.log(this.url);
                }else{
                    this.url = this.moviesDetail.movies.url
                    .replace('.html', '/' + this.moviesDetail
                    .moviesEpisodes[this.moviesDetail.moviesLink.numEpisodes].url
                    + '.html')
                    console.log(this.url);
                }
            }
        },
    };
</script>

<style lang="less" scoped>
.moviesPlay {
    height: 100%;
    width: 100%;
    background-color: #000;
    .play-box {
        width: 100%;
        height: 100%;
        iframe{
            height: 100%;
            width: 100%;
            overflow: hidden;
        }
    }
}
</style>
